package org.baicaixiaozhan.learn.guava.collect;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.baicaixiaozhan.learn.guava.domain.Person;

import java.util.Map;

/**
 * DESC: {@link Table} 示例
 *
 * @author baicaixiaozhan
 * @since 2020/11/13
 */
public class TableDemo {

    public static void main(String[] args) {

        Table<String, String, Person> hashBasedTable = HashBasedTable.create();
        hashBasedTable.put("张", "深圳", new Person("张", "三", "深圳"));
        hashBasedTable.put("张", "广州", new Person("张", "小二", "广州"));
        hashBasedTable.put("李", "深圳", new Person("李", "四", "深圳"));
        hashBasedTable.put("李", "广州", new Person("李", "小二", "广州"));

        System.out.println(hashBasedTable.row("张").toString());
        System.out.println(hashBasedTable.column("广州").toString());
    }
}
